import logging

import pytest

from resource.pom.settings import Settings
from resource.pom.system_ui import SystemUI


class Test:
    system_ui = SystemUI

    @pytest.mark.parametrize('setup_teardown', [None], indirect=True)
    def test(self, setup_teardown, device):
        logging.info('步骤1.1、进入桌面，左上角反复下划进入通知中心5次')
        for i in range(5):
            device.dropdown_notification_bar()
            device.wait(2)
            if i == 4:
                device.refresh_layout()
                logging.info('预期结果1.1、通知中心画面稳定，无卡死现象')
                device.assert_text_exist('没有通知')
            device.swipe_up_dropdown_pan()

        logging.info('步骤1.2、进入桌面，右上角反复下滑进入控制中心5次')
        for i in range(5):
            device.dropdown_controller_center()
            device.wait(1)
            if i == 4:
                device.refresh_layout()
                logging.info('预期结果1.2、控制中心画面稳定，无卡死现象')
                device.assert_text_exist('控制中心')
            device.swipe_up_dropdown_pan()

        logging.info('步骤2、下滑控制栏，点击设置')
        device.dropdown_controller_center()
        device.wait(1)
        device.click(*self.system_ui.setting_btn)
        device.wait(1)
        device.assert_current_window(Settings.window_name)
